from bpy.utils import previews

previews_icons = previews.new()  # 用于存所有的缩略图


def get(name):
    if name in previews_icons:
        return previews_icons[name].icon_id
    else:
        add(name)
        return previews_icons[name].icon_id


def add(path):
    if path not in previews_icons:
        previews_icons.load(path, path, "IMAGE", )
